<template>
    <div class="search_Data">
        <el-form :model="form">
            <el-form-item label="">
                <el-radio-group v-model="form.state" label="size control" size="default">
                    <el-radio-button label="large">上一周</el-radio-button>
                    <el-radio-button label="default">本周</el-radio-button>
                    <el-radio-button label="small">下一周</el-radio-button>
                </el-radio-group>
                <div class="keshi" style="width:120px">
                    <el-select v-model="form.region" placeholder="请选择科室">
                        <el-option label="呼吸内科" value="呼吸内科" />
                        <el-option label="消化内科" value="消化内科" />
                    </el-select>
                </div>
                <!-- 请选择科室 -->
                <div style="width:230px;margin-right:5px">
                    <el-input v-model="form.name" placeholder="请输入医生病人姓名" />
                </div>

                <div class="searchbtn">
                    <el-button type="primary" @click="onSubmit">搜索</el-button>
                </div>
            </el-form-item>
        </el-form>

    </div>
</template>

<script setup lang="ts">
import { emitChangeFn } from 'element-plus';
import { reactive, ref } from 'vue'
interface Iprops {
    loadData: (currentPage: number, pageSize: number, formdata: Record<string, string>) => void
    pageSize: number
    currentPage: number
}
const props = defineProps<Iprops>()
// do not use same name with ref
export interface formType {
    "state"?: string
    "timer"?: string
    "region"?: string
    "name"?: string
}

const form = reactive({
    state: '',
    timer: '',
    region: '',
    name: '',
})

const onSubmit = () => {
    // var formdata=new FormData();
    // for(let key in form){
    //     formdata.append(key,form[key]);
    // }
    console.log(form)
    //???获取不到嘞 获取不到所以走get请求，走不到post请求
    props.loadData(props.currentPage, props.pageSize, form)

}
</script>

<style scoped>
.search_Data {
    width: 100%;
    float: none;
    padding-top: 10px;
}

.keshi {
    margin-left: 10px;
    margin-right: 10px;
}

/* .date{
    margin-left: 15px;
}*/
.searchbtn {
    margin-left: 5px;
}
</style>